import { RoomStatusEnum } from "@/constants/enum";
import { getFloorList } from "@/services/floor/floor";
import { objToArr } from "@/utils";
import { useRequest } from "@umijs/max";
import { Input, Select } from "antd";

export const useConfig = (props) => {
  const { data: floorList } = useRequest(getFloorList);
  let arr = [
    {
      label: "房间号",
      name: "roomNum",
      children: <Input placeholder="请输入" style={{ width: 300 }} />,
    },
    {
      label: "状态",
      name: "occupied",
      children: (
        <Select
          fieldNames={{
            label: "value",
            value: "key",
          }}
          options={objToArr(RoomStatusEnum)}
          placeholder="请选择"
          style={{ width: 300 }}
        />
      ),
    },
    {
      label: "楼层",
      name: "floorId",
      children: (
        <Select
          options={floorList}
          fieldNames={{
            label: "floorName",
            value: "floorId",
          }}
          placeholder="请选择"
          style={{ width: 300 }}
        />
      ),
    },
  ];

  return arr;
};
